<?php
require_once "utilHtml.php";
echo "scenarios de test de tabToHtml\n";
// Q2 scenario de test tableau vide
$tab=array();
$expectedHtmlTab="<table border=1><tr><td>(vide)</td></tr></table>";
assert($expectedHtmlTab==UtilHtml::tabToHtml($tab,50)); //valeur qqe pour maxRows, ici 50



//Q3 scenario de test tableau 1 element, a concurrence de maxRows
$tab=array('A');
$expectedHtmlTab="<table border=1><tr><td>A</td></tr></table>";
assert($expectedHtmlTab==UtilHtml::tabToHtml($tab,50)); //valeur qqe pour maxRows, ici 50
//
//
//Q4 scenario de test general : à concurrence de maxRows
$tab = array('A', 'B', 'C');
$expectedHtmlTab="<table
border=1><tr><td>A</td></tr><tr><td>B</td></tr><tr><td>C</td></tr></table>";
assert($expectedHtmlTab==UtilHtml::tabToHtml($tab,count($tab)));


//Q5 scenario de test de maxRows, cas N et N-1 (1 a N-1)
$tab = array('A', 'B', 'C');
$expectedHtmlTab="<table
border=1><tr><td>A</td></tr><tr><td>B</td></tr><tr><td>...</td></tr></table>";
assert($expectedHtmlTab==UtilHtml::tabToHtml($tab,count($tab)-1));


//Q6 scenario de test de maxRows, cas N et N/2 (ex 3/2)
$tab = array('A', 'B', 'C');
$expectedHtmlTab="<table border=1><tr><td>A</td></tr><tr><td>...</td></tr></table>";
assert($expectedHtmlTab==UtilHtml::tabToHtml($tab,count($tab)/2));

?>
